package com.itheima.fanshe;

import com.itheima.domain.Student;

import java.lang.reflect.Method;
import java.util.Arrays;

/*
获取类的方法对象
 */
public class Demo10 {

    public static void main(String[] args) throws NoSuchMethodException {
        Class<Student> clazz = Student.class;
        Method[] methods = clazz.getMethods();
        System.out.println(Arrays.toString(methods));
        Method[] declaredMethods = clazz.getDeclaredMethods();
        System.out.println(Arrays.toString(declaredMethods));
        Method study = clazz.getMethod("study");
        System.out.println(study);
        Method toString = clazz.getMethod("toString");
        System.out.println(toString);
        Method wait = clazz.getMethod("wait", long.class);
        System.out.println(wait);
        Method eat = clazz.getDeclaredMethod("eat");
        System.out.println(eat);

    }
}
